package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TrailMapper;
import com.ruoyi.system.domain.Trail;
import com.ruoyi.system.service.ITrailService;
import com.ruoyi.common.core.text.Convert;

/**
 * 车辆轨迹信息Service业务层处理
 * 
 * @author zbb
 * @date 2023-02-13
 */
@Service
public class TrailServiceImpl implements ITrailService 
{
    @Autowired
    private TrailMapper trailMapper;

    /**
     * 查询车辆轨迹信息
     * 
     * @param trailId 车辆轨迹信息主键
     * @return 车辆轨迹信息
     */
    @Override
    public Trail selectTrailByTrailId(Long trailId)
    {
        return trailMapper.selectTrailByTrailId(trailId);
    }

    /**
     * 查询车辆轨迹信息列表
     * 
     * @param trail 车辆轨迹信息
     * @return 车辆轨迹信息
     */
    @Override
    public List<Trail> selectTrailList(Trail trail)
    {
        return trailMapper.selectTrailList(trail);
    }

    /**
     * 新增车辆轨迹信息
     * 
     * @param trail 车辆轨迹信息
     * @return 结果
     */
    @Override
    public int insertTrail(Trail trail)
    {
        trail.setCreateTime(DateUtils.getNowDate());
        return trailMapper.insertTrail(trail);
    }

    /**
     * 修改车辆轨迹信息
     * 
     * @param trail 车辆轨迹信息
     * @return 结果
     */
    @Override
    public int updateTrail(Trail trail)
    {
        trail.setUpdateTime(DateUtils.getNowDate());
        return trailMapper.updateTrail(trail);
    }

    /**
     * 批量删除车辆轨迹信息
     * 
     * @param trailIds 需要删除的车辆轨迹信息主键
     * @return 结果
     */
    @Override
    public int deleteTrailByTrailIds(String trailIds)
    {
        return trailMapper.deleteTrailByTrailIds(Convert.toStrArray(trailIds));
    }

    /**
     * 删除车辆轨迹信息信息
     * 
     * @param trailId 车辆轨迹信息主键
     * @return 结果
     */
    @Override
    public int deleteTrailByTrailId(Long trailId)
    {
        return trailMapper.deleteTrailByTrailId(trailId);
    }
}
